package com.fqy.thread02.callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * User: fqy
 * Date: 2021/9/1
 * Time: 22:51
 * Describe: 第三种获得多线程的方式
 */
public class CallableDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> futureTask = new FutureTask<>(new MyThread());
        Thread thread = new Thread(futureTask, "t1");
        thread.start();

        System.out.println(futureTask.get());
    }
}
